﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="EngineStartParameters.cs" company="dimamartovoi">
//   Apache License
//   Version 2.0, January 2004
//   http://www.apache.org/licenses
// </copyright>
// <summary>
//   The engine start parameters.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

namespace ActorModel.Infrastructure
{
    /// <summary>
    /// The engine start parameters.
    /// </summary>
    /// <typeparam name="TState">
    /// </typeparam>
    public sealed class EngineStartParameters<TState>
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="EngineStartParameters{TState}"/> class.
        /// </summary>
        /// <param name="numberOfNodes">
        /// The number of nodes.
        /// </param>
        /// <param name="numberOfNodeConnectors">
        /// The number of node connectors.
        /// </param>
        /// <param name="nodesInitialStates">
        /// The nodes initial states.
        /// </param>
        /// <param name="connectorsInitialStates">
        /// The connectors initial states.
        /// </param>
        /// <param name="evolutionFunc">
        /// The evolution func.
        /// </param>
        public EngineStartParameters(
            int numberOfNodes, 
            int numberOfNodeConnectors, 
            IDictionary<int, TState> nodesInitialStates, 
            IDictionary<int, ConnectorInfo<TState>> connectorsInitialStates, 
            Func<TState, IEnumerable<TState>, IEnumerable<TState>> evolutionFunc)
            : this()
        {
            this.EvolutionFunc = evolutionFunc;
            this.ConnectorsInfo = connectorsInitialStates;
            this.NodesInitialStates = nodesInitialStates;
            this.NumberOfNodeConnectors = numberOfNodeConnectors;
            this.NumberOfNodes = numberOfNodes;
        }

        /// <summary>
        ///     Initializes a new instance of the <see cref="EngineStartParameters{TState}" /> class.
        /// </summary>
        public EngineStartParameters()
        {
            this.ConnectorsInfo = new Dictionary<int, ConnectorInfo<TState>>();
            this.NodesInitialStates = new Dictionary<int, TState>();
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///     Gets the connectors info.
        /// </summary>
        public IDictionary<int, ConnectorInfo<TState>> ConnectorsInfo { get; set; }

        /// <summary>
        ///     Gets the evolution func.
        /// </summary>
        public Func<TState, IEnumerable<TState>, IEnumerable<TState>> EvolutionFunc { get; set; }

        /// <summary>
        ///     Gets the nodes initial states.
        /// </summary>
        public IDictionary<int, TState> NodesInitialStates { get; set; }

        /// <summary>
        ///     Gets the number of node connectors.
        /// </summary>
        public int NumberOfNodeConnectors { get; set; }

        /// <summary>
        ///     Gets the number of nodes.
        /// </summary>
        public int NumberOfNodes { get; set; }

        #endregion
    }
}